<%
# Copyright (C) 2012 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<h3 style="margin: 0px;">{{#t}}Questions{{/t}}</h3>
<ul id="question_list" style="max-height: 200px; overflow: auto;" class="<%= 'read_only' if @quiz_presenter.cant_go_back? %>">
  <% @quiz_presenter.all_questions.each do |q| %>
    <% icon   = @quiz_presenter.answered_icon(q) %>
    <% text   = @quiz_presenter.answered_text(q) %>
    <% marked = @quiz_presenter.marked_text(q) %>

    <li id="list_question_<%= q[:id] %>" class="<%= @quiz_presenter.question_class(q) %>">
      <% if @quiz_presenter.one_question_at_a_time? %>
        <% if @quiz_presenter.cant_go_back? %>
          <span>
            <i class="placeholder <%= icon %>"><span class="screenreader-only icon-text"><%= text %></span></i><%= q[:question_name] %>
            <span class="screenreader-only marked-status"><%= marked %></span>
          <span>
        <% else %>
          <%= link_to @quiz_presenter.question_path(q[:id]), :class => "no-warning" do %>
            <i class="placeholder <%= icon %>"><span class="screenreader-only icon-text"><%= text %></span></i><%= q[:question_name] %>
            <span class="screenreader-only marked-status"><%= marked %></span>
          <% end %>
        <% end %>

      <% else %>
        <a class="jump_to_question_link" href="#question_<%= q[:id] %>">
          <i class="placeholder <%= icon %>"><span class="screenreader-only icon-text"><%= text %></span></i><%= q[:question_name] %>
          <span class="screenreader-only marked-status"><%= marked %></span>
        </a>
      <% end %>
    </li>
  <% end %>
</ul>
